﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace natureskitchen
{
    public partial class frmCloseRestaurant : Form
    {
        public frmCloseRestaurant()
        {
            InitializeComponent();
        }

        private void btnYes_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnNo_Click(object sender, EventArgs e)
        {
            frmDailyNumbers dailynumbers = new frmDailyNumbers();
            dailynumbers.Show();
            this.Close();
        }

        private void frmCloseRestaurant_Load(object sender, EventArgs e)
        {
            mysql.connectDB();
            string selectquery = "SELECT * FROM DailyNumbers WHERE Date = " + DateTime.Today.ToString("yyyy-MM-dd");
            DataSet ds = new DataSet("TodayDataSet");
            MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter(selectquery, mysql.connectDB());
            da.Fill(ds, "DailyNumbers");
            mysql.disconnectDB();

            if (ds.Tables["DailyNumbers"].Rows.Count < 1)
            {
                btnYes.Enabled = false;
            }
        }

    }
}
